import { debounce } from '@/utils'

/**
 * 防抖装饰器
 * @param wait {number}
 * @param immediate {boolean}
 * @returns {(function(*, *, *): void)|*}
 */
function debounceDecorator(wait = 200, immediate = true) {
  return function(target, name, descriptor) {
    descriptor.value = debounce(descriptor.value, wait, immediate)
  }
}

export default debounceDecorator
